SQL Server job steps often need to do more than just
execute Transact-SQL. In order to perform tasks such as operating
system commands (CmdExec),
executing Integration Services packages, and PowerShell scripts,
various credentials often associated with Windows logins are necessary.
SQL Server Agent Proxies mapped to the appropriate credentials
necessary can be created and associated with one or more SQL Server
Agent subsystems. You can associate one or more proxies with the
available SQL Server Agent subsystems. See Figure 1 for the SQL Server Agent subsystems that you can associate to proxies.
Warning
Make
sure that you understand how the SQL Server Agent uses Proxies and how
the credentials used need to have sufficient permissions to perform the
required task but not in excess of what is needed.
Exercise . Create a SQL Server Agent Proxy
You
need to set up a Proxy so that SQL Server Agent can create a file in a
Windows directory. We need to set up a credential for the Proxy to use
and then set up the Proxy that can work with the SQL Server Agent
Operating System (CmdExec). Make sure that SQL Server Agent has been
started before attempting this exercise.
In the SQL Server Management Studio expand the Security folder.
Right-Click on the Credentials folder and select New Credential.
In
the New Credential window assign a Credential name, select a User or
Built-in security principal as the Identity, then provide and confirm a
password.
Click the OK button to create the Credential.
Now locate the Proxies folder under SQL Server Agent, right-click on the Operating System (CmdExec) folder and select New Proxy.
In the General section enter a Proxy name in the Proxy name: textbox.
In the Credential textbox, enter the Credential that you created in Step 3.
In the Subsystem section, make sure that Operating System (CmdExec) is checked.
Click OK to create the Proxy.